//21
function merge(list1, list2) {
  let p1 = list1;
  let p2 = list2;
  const head = {};
  let cur = head;
  while (p1 != null && p2 != null) {
    if (p1.val <= p2.val) {
      cur.val = p1.val;
      p1 = p1.next;
    } else {
      cur.val = p2.val;
      p2 = p2.next;
    }
    cur.next = {};
    cur = cur.next;
  }
  while (p1 != null) {
    cur.val = p1.val;
    p1 = p1.next;
    if (p1 !== null) {
      cur.next = {};
      cur = cur.next;
    }
  }
  while (p2 != null) {
    cur.val = p2.val;
    p2 = p2.next;
    if (p2 != null) {
      cur.next = {};
      cur = cur.next;
    }
  }
  return head;
}
console.log(merge(null, { val: 0, next: null }));
console.log(1);
